﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IOC.Util
{
   public class CompareUtil
    {
		public static bool IsAssignableFrom(Type Type, Type BaseType)
		{
			bool Flag = false;
			if (!BaseType.IsGenericType)
			{
				Flag = BaseType.IsAssignableFrom(Type);
			}
			else
			{
				Type[] Interfaces = Type.GetInterfaces();
				Type[] array = Interfaces;
				foreach (Type item in array)
				{
					if (item.IsGenericType)
					{
						Type t = item.GetGenericTypeDefinition();
						if (t == BaseType)
						{
							Flag = true;
							break;
						}
					}
				}
			}
			return Flag;
		}
	}
}

